package com.swpu.project.controller;


import com.swpu.project.common.BaseResponse;
import com.swpu.project.model.dto.data.DataEntityDto;
import com.swpu.project.model.entity.Native;
import com.swpu.project.model.page.PageQuery;
import com.swpu.project.service.INativeService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author swpuyanxiegroup1
 * @since 2024-07-29
 */
@RestController
@RequestMapping("/native")
public class NativeController {

    @Resource
    INativeService iNativeService;
@PreAuthorize("@verf.hasAnyAuthorityForBlock('sys_add')")
@PostMapping("/add")
    BaseResponse addNative(@RequestBody List<DataEntityDto> dataEntityDtos)
 {



     return    iNativeService.addData(dataEntityDtos);


 }

@PutMapping("/update")
@PreAuthorize("@verf.hasAnyAuthorityForBlock('sys_update')")
 BaseResponse updateNative(@RequestBody List<Native> aNative)
{

return iNativeService.updateData(aNative);

}


@GetMapping("/pagequery")
@PreAuthorize("@verf.hasAnyAuthorityForBlock('sys_query','sys_manage')")
BaseResponse pageQueryNative(@RequestBody PageQuery pageQuery)
{

    return iNativeService.pageQuery(pageQuery);
}







}
